package br.com.betioli.jme.games.sokobob;

import br.com.betioli.jme.games.sokobob.i18n.Messages;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.List;

/**
 *
 * @author Alexandre Parra Betioli
 */
public class MenuList extends List {

    private Command selComand;
    private Command exitCommand;
    
    public MenuList() {
        super(Messages.getMessage("menu-title"), List.IMPLICIT, new String[] { 
            Messages.getMessage("newgame"),
            Messages.getMessage("instructions-title"),
            Messages.getMessage("about-title"),
            Messages.getMessage("command-exit")
        }, null); 
        
        exitCommand = new Command(Messages.getMessage("command-exit"), Command.EXIT, 0);
        selComand = new Command(Messages.getMessage("command-select"), Command.ITEM, 0);
        
        setSelectCommand(selComand);
        addCommand(exitCommand);
    }
    
    public void addContinue() {
        this.insert(0, Messages.getMessage("continue"), null);
        this.setSelectedIndex(0, true);
    }
    
    public void removeContinue() {
        this.deleteAll();
        this.append(Messages.getMessage("newgame"), null);
        this.append(Messages.getMessage("instructions-title"), null);
        this.append(Messages.getMessage("about-title"), null);
        this.append(Messages.getMessage("command-exit"), null);
    }

}
